package com.eling.elcms.travel.model;

import com.eling.elcms.core.dao.annotation.Between;
import com.eling.elcms.core.dao.annotation.In;
import com.eling.elcms.core.dao.hibernate.search.EnumBridge;
import com.eling.elcms.core.model.BaseModel;
import com.eling.elcms.system.model.CommonUser;
import org.hibernate.search.annotations.*;

import javax.persistence.*;
import java.util.Date;
/**
 * 退证
 * @author ljz
 *
 */
@Entity
@Indexed
@Table(name = "travel_returncredentials")
public class ReturnCredentials extends BaseModel{

	private static final long serialVersionUID = -4571358211024066352L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@DocumentId
	@In
	private Long pkReturnCredentials;
	
	/** 合同签约 */
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "pkTravelContract")
	@IndexedEmbedded(depth = 1)
	private TravelContract travelContract;
	
	/** 违约金比例 */
	@Field
	@Column
	private Double defaultRatio;
	
	/** 工本费 */
	@Field
	@Column
	private Double flatCost;
	
	/** 应退金额(元) */
	@Field
	@Column
	private Double price;
	
	/** 申请日期 */
	@Column
	@Field
	@Between
	private Date operateDate;
	
	/** 经办人 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "operator")
	@IndexedEmbedded(depth = 1)
	private CommonUser operator;
	
	/** 退证原因 */
	@Field
	@Column
	private String cause;
	
	/** 状态  */
	@Enumerated(EnumType.STRING)
	@In	
	@FieldBridge(impl = EnumBridge.class)
	private FlowStatus flowStatus;
	
	
	
	@Version
	private Integer version;

	public Long getPkReturnCredentials() {
		return pkReturnCredentials;
	}

	public void setPkReturnCredentials(Long pkReturnCredentials) {
		this.pkReturnCredentials = pkReturnCredentials;
	}

	public TravelContract getTravelContract() {
		return travelContract;
	}

	public void setTravelContract(TravelContract travelContract) {
		this.travelContract = travelContract;
	}

	public Double getDefaultRatio() {
		return defaultRatio;
	}

	public void setDefaultRatio(Double defaultRatio) {
		this.defaultRatio = defaultRatio;
	}

	public Double getFlatCost() {
		return flatCost;
	}

	public void setFlatCost(Double flatCost) {
		this.flatCost = flatCost;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Date getOperateDate() {
		return operateDate;
	}

	public void setOperateDate(Date operateDate) {
		this.operateDate = operateDate;
	}

	public CommonUser getOperator() {
		return operator;
	}

	public void setOperator(CommonUser operator) {
		this.operator = operator;
	}

	public String getCause() {
		return cause;
	}

	public void setCause(String cause) {
		this.cause = cause;
	}

	public FlowStatus getFlowStatus() {
		return flowStatus;
	}

	public void setFlowStatus(FlowStatus flowStatus) {
		this.flowStatus = flowStatus;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

}
